package com.example.projectcode.service.impl;

import com.baomidou.mybatisplus.core.conditions.query.QueryWrapper;
import com.baomidou.mybatisplus.extension.service.impl.ServiceImpl;
import com.example.projectcode.mapper.TestCpstuanMapper;
import com.example.projectcode.model.TestCpstuan;
import com.example.projectcode.service.TestCpstuanService;
import com.example.projectcode.vo.TestCpstuanVo;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.stereotype.Service;

import java.util.List;

@Service
public class TestCpstuanServiceImpl extends ServiceImpl<TestCpstuanMapper, TestCpstuan> implements TestCpstuanService {

   @Autowired
   private TestCpstuanMapper testCpstuanMapper;

    @Override
    public int insertComprehensive(TestCpstuanVo testCpstuanVo) {

        TestCpstuan testCpstuan = new TestCpstuan();

        testCpstuan.setTestCpid(testCpstuanVo.getTestCpid());
        testCpstuan.setStuId(testCpstuanVo.getStuId());
        testCpstuan.setTestCpStuanc(testCpstuanVo.getTestCpstuanc());

        return baseMapper.insert(testCpstuan);
    }

    @Override
    public List<TestCpstuan> selectAllByStuId(Integer stuId) {
        return baseMapper.selectList(new QueryWrapper<TestCpstuan>().eq("Stu_id",stuId));
    }

    @Override
    public int updatetestCpstuanById(Integer testCpstuanid, Integer teaid, String teacom) {
        return testCpstuanMapper.updateTestCpstuanById(testCpstuanid,teaid,teacom);
    }
}
